export const tableOption = {
  labelPosition: "left",
  labelSuffix: "：",
  labelWidth: 120,
  gutter: 0,
  menuBtn: true,
  align: "center",
  stripe: true,
  submitBtn: true,
  submitText: "提交",
  emptyBtn: true,
  emptyText: "清空",
  menuPosition: "center",
  border: true,
  index: true,
  indexLabel: "序号",
  addBtn: false,
  editBtn: false,
  delBtn: false,
  cellBtn: true,
  menuWidth: 250,
  searchEnter: true,
  column: [
    {
      label: "产品类型",
      prop: "productLineType",
      type: "select",
      dicUrl: "/admin-api/system/dict-data/type?type=product_line",
      props: {
        label: "label",
        value: "value",
      },
      dicMethod: "get",
      search: true,
      searchLabelWidth: 100,
    },
    {
      type: "input",
      label: "产品工艺名称",
      span: 12,
      display: true,
      prop: "productProcessName",
      search: true,
      searchLabelWidth: 120,
    },
    {
      type: "select",
      label: "品号",
      span: 12,
      display: true,
      prop: "articleNumber",
      cell: true,
      filterable: true,
      dicUrl: "/admin-api/o3-workorder/workordercps/getItemCodeList",
      props: {
        label: "label",
        value: "value",
      },
      dicMethod: "get",
      search: true,
    },
    {
      label: "流程图号",
      prop: "flowChartNo",
      type: "input",
      span: 12,
    },
    {
      type: "select",
      label: "工艺模板",
      span: 12,
      display: true,
      prop: "craftId",
      dicUrl: "/admin-api/o3-pfoc/craftproduct/getCraftProductList",
      props: {
        label: "craftLineName",
        value: "id",
      },
      dicMethod: "get",
      search: true,
      searchLabelWidth: 100,
    },
    /* {
      type: "input",
      label: "工序",
      span: 12,
      display: true,
      overHidden: true,
      prop: "processNodes",
      formatter:(row, value,column) => {
        var html="";
        const json = JSON.parse(value);
        for (var i=0;i<json.length;i++){
          html = html+json[i].name+";";
        }
        return html;
      }
    },
    {
      type: "input",
      label: "工序顺序",
      span: 12,
      display: true,
      prop: "processNodeLine",
      overHidden: true,
      formatter:(row, value,column) => {
        var html="";
        let  json = JSON.parse(value);
        const len = json.length
        for (let i = 0; i < len; i++) {
          for (let j = i+1; j < len; j++) {
            if ( json[i].from ==json[j].to ) {
              const temp = json[j]
              json[j] = json[i]
              json[i] = temp
            }
            if(json[i].to ==json[j].to){
              const temp = json[j]
              json[j] = json[i]
              json[i] = temp
            }
          }
        }

        // console.log(json)
        let newArr =[];
        for(var i =0;i<json.length;i++){
          newArr.push(json[i].from)
          if(i==json.length-1) {
            newArr.push(json[i].to)
          }
        }
        let nameStr ="";
        const json2 = JSON.parse(row.processNodes);
        for(var n =0;n<newArr.length;n++){
          for (var m=0;m<json2.length;m++){
            if(newArr[n]==json2[m].id) {
              nameStr = nameStr + json2[m].name + ";";
            }
          }
        }
        return nameStr;
      }
    },*/
    {
      type: "input",
      label: "标准工时",
      prop: "standardWorkHours",
      span: 12,
      display: true,
      hide: false,
      formatter: (val) => {
        if (val.standardWorkHours == undefined) {
          return "--";
        } else {
          return val.standardWorkHours + " (分/件)";
        }
      },
    },
    {
      prop: "createBy",
      span: 12,
      type: "input",
      label: "创建人",
      dicUrl: "/admin/user/getAllUser",
      props: {
        label: "name",
        value: "username",
      },
      dicMethod: "get",
      display: false,
      hide: false,
    },
    {
      prop: "createTime",
      span: 12,
      type: "datetime",
      label: "创建时间",
      format: "yyyy-MM-dd HH:mm:ss",
      display: false,
      hide: false,
      valueFormat: "yyyy-MM-dd HH:mm:ss",
    },
  ],
};
